1. Field of the Invention
The present invention relates to a graphic processing apparatus which can provide a high quality image and a method thereof.
2. Description of the Related Art
Computer graphics are often used in a variety of computer aided design (CAD) systems and amusement machines. Especially, along with the recent advances in image processing techniques, systems using three-dimensional computer graphics are becoming rapidly widespread.
In three-dimensional computer graphics, the color value of each pixel is calculated at the time of deciding the color of each corresponding pixel. Then, rendering is performed for writing the calculated value to an address of a display buffer (frame buffer) corresponding to the pixel.
One of the rendering methods is polygon rendering. In this method, a three-dimensional model is expressed as an composite of triangular unit graphics (polygons). By drawing the polygons as units, the colors of the pixels of the display screen are decided.
In polygon rendering, coordinates (x, y, z), color data (R, G, B), homogeneous coordinates (s, t) of texture data indicating a composite image pattern and values of a homogeneous term g for the inside of a triangle are found by interpolation from the vertexes of a triangle in a physical coordinate system.
Here, the homogeneous term q is, simply stated, like an expansion or reduction rate. Coordinates in a UV coordinate system of an actual texture buffer, namely, texture coordinate data (u, v), are in accordance with the homogeneous coordinates (s, t) divided by the homogeneous term q to give (s/q, t/q)=(u, v) which in turn are multiplied by texture sizes USIZE and VSIZE, respectively.
In a three-dimensional computer graphic system using such polygon rendering, the texture data is read from the texture buffer when drawing, and texture mapping is performed for applying the read texture data on the surface of the three-dimensional model to obtain image data of a high degree of reality.
Note that when texture mapping is performed on a three-dimensional model, the expansion/reduction rate of the image indicated by the texture data to be applied to each pixel changes.
To perform the texture mapping, as a method for obtaining a high quality picture, there is the MIP MAP (texture for a plurality of resolutions) filtering method.
In the MIPMAP filtering, as shown in FIG. 9, a plurality of already filtered texture data 200, 201, 202, and 203 corresponding to a plurality of different reducing rates are prepared in advance. By selecting texture data 205 corresponding to a reducing rate 204 of the respective pixels, the most suitable texture data 206 for the reducing rate 204 is used and the aliasing effect caused by loss of data accompanying the reduction of an image is suppressed.
Below, a texture mapping apparatus in a case of MIPMAP filtering will be explained.
FIG. 10 is a view for explaining a texture mapping apparatus 210 and FIG. 11 is a flow chart of the processing in the texture mapping apparatus 210.
Step S1: First, the texture mapping apparatus 210 receives as input data (s1, t1, q1), (s2, t2, q2), and (s3, t3, q3) indicating homogeneous coordinates and homogeneous terms of the vertexes of a triangle.
Step S2: Next, the texture mapping apparatus. 210 performs linear interpolation on the data (s1, t1, q1), (s2, t2, q2), and (S3, t3, q3) to obtain the data (s, t, q) indicating homogeneous coordinates and homogeneous terms of the pixels inside the triangle.
Step S3: In the texture mapping apparatus 210, a built-in reducing rate calculation apparatus 212 calculates reducing rates xe2x80x9clodxe2x80x9d of the pixels from the (s, t, q) data of the pixels inside the triangle.
Step S4: The texture mapping apparatus 210 calculates the texture coordinate data (u, v) by calculating u data obtained by dividing the s data by the q data and the v data obtained by dividing the t data by the q data for the (s, t, q) data of the pixels.
Next, the texture mapping apparatus 210 calculates the texture address (U, V) as a physical address in the texture buffer 211 from the reducing rate xe2x80x9clodxe2x80x9d obtained in the reducing rate calculation apparatus and the texture coordinate data (u, v).
Step S5: The texture mapping apparatus 210 outputs the texture address (U, V) to the texture buffer 211 and reads the texture data (R, G, B).
Step S6: The texture mapping apparatus 210 performs predetermined processing on the texture data read at Step S5 to obtain the pixel data S210 and writes the pixel data S210 in the display buffer 213.
As a result, the texture data corresponding to the reducing rate xe2x80x9clodxe2x80x9d among a plurality of texture data corresponding to a plurality of different reducing rates stored in the texture buffer 211 can be accessed.
To realize drawing at a high speed, there is a high speed texture mapping apparatus which performs texture mapping on a plurality of pixels in parallel and writes the pixel data in the display buffer simultaneously.
In this high speed texture mapping apparatus, as shown in FIG. 12, the data (s1, t1, q1), (S2, t2, q2), and (s3, t3, q3)of the vertexes of the triangle are processed in parallel in n number of texture mapping apparatuses 2101 to 210n. The results of the processing, that is, the pixel data S2101 to S210n, are written in the display buffer simultaneously.
Namely, texture mapping is performed in parallel (simultaneously) on a plurality of pixels.
Note that the texture mapping is performed for a triangle as a unit graphic and that processing conditions such as the reducing rate of the texture data are determined for triangles as units. Among the plurality of pixels simultaneously processed, only the results of the processing for the pixels positioned inside the triangle are valid, while the results of the processing on the pixels outside the triangle are invalid.
Summarizing the problems to be solved by the invention, the calculation to obtain the reducing rate xe2x80x9clodxe2x80x9d includes many multiplication operations and division operations, so an enormous amount of calculation is required.
Therefore, as shown in FIG. 12, if the reducing rate calculation apparatuses 2121 to 212n are built in the respective n number of texture mapping apparatuses 2101 to 210n, though it is possible to realize high speed processing, there is a disadvantage that the apparatus becomes large in size.
In order to overcome the disadvantage, a method may be considered of building the reducing rate calculation apparatus in only one texture mapping apparatus among a plurality of texture mapping apparatuses performing the parallel processing, making a pixel processed by the texture mapping apparatus a representative point in obtaining the reducing rate, and using the reducing rate obtained in the reducing rate calculation apparatus in all of the texture mapping apparatuses.
In this case, the position of the pixel serving as the representative point among the plurality of pixels simultaneously processed becomes fixed.
Accordingly, there is a possibility that a pixel positioned outside of the unit graphic, that is, triangle, will becomes the representative point among the plurality of pixels simultaneously processed.
Since the reducing rates largely differ between inside and the outside of the triangle, if a pixel outside the triangle processed becomes the representative point, the most suitable texture data cannot be selected for the pixels inside the triangle. As a result, there is a disadvantage that the picture quality will be considerably degraded.
An object of the present invention is to provide a graphic processing apparatus which can stably provide a high quality picture with a small hardware configuration and a method thereof.
According to a first aspect of the present invention, there is provided a graphic processing apparatus for expressing a three-dimensional model by a composite of a plurality of unit graphics to which common processing conditions are applied, determining a reducing rate from homogeneous coordinates (s,t) and a homogeneous term q included in image data for each pixel, and establishing correspondence between texture data in accordance with the determined reducing rate and the unit graphics, comprising a storage means for storing a plurality of texture data corresponding to different reducing rates; a representative point determining means for determining a pixel as a representative point among pixels positioned inside a unit graphic to be processed among a plurality of pixels simultaneously processed; a reducing rate determining means for determining a reducing rate by using the homogeneous coordinates (s,t) and the homogeneous term corresponding to the determined representative point; and a reading means for reading from the storage means the texture data specified by the determined reducing rate, the homogeneous coordinates (s,t), and the homogeneous term q for each of the plurality of pixels simultaneously processed.
Preferably, only the results of processing for pixels positioned inside the unit graphic to be processed among the plurality of pixels simultaneously processed are used as valid.
Preferably, when there are a plurality of pixels positioned inside the unit graphic to be processed among the plurality of pixels simultaneously processed, the pixel closest to the center of a region defined by the plurality of pixels simultaneously processed among the plurality of pixels positioned inside the unit graphic is determined as the representative point.
Preferably, the reading means reads the texture data corresponding to a pixel from a physical address determined by a reference address in a storage region of the storage means in accordance with the determined reducing rate and a texture address in accordance with the homogeneous coordinates (s,t) and the homogeneous term q.
That is, in the graphic processing apparatus of the first aspect of the present invention, the representative point determining means determines a representative point first from among the pixels inside the unit graphic to be processed in a plurality of pixels simultaneously processed.
Next, the reducing rate calculation means determines the reducing rate from the homogeneous coordinates (s, t) and the homogeneous term q corresponding to the determined representative point.
Next, the reading means reads the texture data specified by the determined reducing rate, homogeneous coordinates (s, t), and homogeneous term q for the pixels to be simultaneously processed from the memory means.
According to a second aspect of the present invention, there is provided a graphic processing apparatus for expressing a three-dimensional model by a composite of a plurality of unit graphics to which common processing conditions are applied and establishing correspondence of texture data showing an image with the unit graphics, comprising a storage means for storing a plurality of texture data corresponding to different reducing rates; a polygon rendering data generating means for generating polygon rendering data including three-dimensional coordinates (x, y, z), red (R) data, green (G) data, blue (B) data, homogeneous coordinates (s,t), and a homogeneous term q for each of the vertexes of the unit graphics; a data interpolation means for performing interpolation on the polygon rendering data of the vertexes of a unit graphic to generate image data of a pixel positioned inside the unit graphic; and a texture processing means for determining a reducing rate by using the homogeneous coordinates (s,t) and homogeneous term q and establishing correspondence between the texture data in accordance with the determined reducing rate and the unit graphics, the texture processing means comprising a representative point determining means for determining a pixel as a representative point among pixels positioned inside a unit graphic to be processed among a plurality of pixels simultaneously processed; a reducing rate determining means for determining a reducing rate by using the homogeneous coordinates (s,t) and the homogeneous term q corresponding to the determined representative point; and a reading means for reading from the storage means the texture data specified by the determined reducing rate, the homogeneous coordinates (s,t), and the homogeneous term q for each of the plurality of pixels simultaneously processed.
Preferably, the apparatus further comprises a pixel position judging means for judging if each of a plurality of pixels simultaneously processed is positioned inside the unit graphic and generating valid bit data in accordance with the result of the judgment, wherein the representative point determining means of the texture processing measis detenninca the pixel to be the representative point by using the valid hit data.
Preferably, the storage means further stores display data in accordance with the texture data read out by the texture processing means.
That is, in the graphic processing apparatus of the second aspect of the present invention, the polygon rendering data generation means generates the polygon rendering data including the three-dimensional coordinates (x, y, z), R (red), G (green), B (blue) data, the homogeneous coordinates (s, t), and the homogeneous term q for the vertexes of the unit graphic.
Next, the data interpolation means generates the image data of the pixels inside the unit graphic by interpolation from the polygon rendering data of the vertexes of the unit graphic.
Next, the texture processing means determines the reducing rate from the homogeneous coordinates (s, t) and the homogeneous term q included in the image data of the respective pixels and establishes correspondence of texture data in accordance with the determined reducing rate with the unit graphics.
Here, in the texture processing means, the representative point determining unit determines a pixel to be the representative point from among the pixels inside the unit graphic in the pixels simultaneously processed. Next, the reducing rate determining unit determines the reducing rate from the homogeneous coordinates (x, y) and the homogeneous term q corresponding to the determined representative point. Next, the reading unit reads from the memory means the texture data specified by the determined reducing rate, homogeneous coordinates (s, t), and homogeneous term q for the pixels simultaneously processed.
According to a third aspect of the present invention, there is provided a graphic processing apparatus for expressing a predetermined shape to be displayed on a display by a combination of unit graphics by simultaneously performing operations for a plurality of pixels and performing processing using as valid only the results of operations on pixels positioned inside a unit graphic to be processed, comprising a polygon rendering data generating apparatus for generating polygon rendering data including three-dimensional coordinates (x, y, z), red (R) data, green (G) data, and blue (B) data, homogeneous coordinates (s,t), and a homogeneous term q for each vertex of the unit graphic; a rendering apparatus for performing rendering by using the polygon rendering data; and a bus connecting the polygon rendering data generating apparatus and the rendering apparatus; the rendering apparatus comprising a storage means for storing a plurality of texture data corresponding to different reducing rates, a data interpolation means for performing interpolation on polygon rendering data of vertexes of a unit graphic input from the polygon rendering data generating apparatus via the bus to generate image data of a pixel positioned inside the unit graphic, and a texture processing means for determining a reducing rate by using the homogeneous coordinates (s,t) and the homogeneous term q and establishing correspondence of the texture data in accordance with the determined reducing rate with the unit graphics; the texture processing means comprising a representative point determining means for determining a pixel as a representative point among pixels positioned inside a unit graphic to be processed among a plurality of pixels simultaneously processed, a reducing rate determining means for determining a reducing rate by using the homogeneous coordinates (s,t) and the homogeneous term q corresponding to the determined representative point, and a reading means for reading from the storage means the texture data specified by the determined reducing rate, the homogeneous coordinates (s,t), and the homogeneous term q for each of the plurality of pixels simultaneously processed.
According to a fourth aspect of the present invention, there is provided a graphic processing method for expressing a three-dimensional model by a composite of a plurality of unit graphics to which common processing conditions are applied, determining a reducing rate by using homogeneous coordinates (s,t) and a homogeneous term q included in image data for each pixel, and establishing correspondence of texture data in accordance with the determined reducing rate with the unit graphics, comprising the steps of determining a pixel as a representative point among pixels positioned inside a unit graphic to be processed among a plurality of pixels simultaneously processed; determining a reducing rate from the homogeneous coordinates (s,t) and the homogeneous term q corresponding to the determined representative point; and selecting texture data specified by the determined reducing rate, the homogeneous coordinates (s,t), and the homogeneous term q among a plurality of texture data corresponding to different reducing rates prepared in advance and establishing correspondence of the selected texture data with each of the plurality of pixels simultaneously processed.
According to a fifth aspect of the present invention, there is provided a graphic processing method for expressing a three-dimensional model by a composite of a plurality of unit graphics to which common processing conditions are applied and establishing correspondence of texture data indicating image with the unit graphics, comprising the steps of generating polygon rendering data including three-dimensional coordinates (x, y, z), red (R) data, green (G) data, and blue (B) data, homogeneous coordinates (s,t) and a homogeneous term q for each vertex of the unit graphics; performing interpolation on the polygon rendering data of the vertexes of a unit graphic to generate image data of a pixel positioned inside the unit graphic; determining a pixel as a representative point among pixels positioned inside a unit graphic to be processed among a plurality of pixels simultaneously processed; determining a reducing rate from the homogeneous coordinates (s,t) and the homogeneous term g corresponding to the determined representative point; and selecting texture data specified by the determined reducing rate, the homogeneous coordinates (s,t), and the homogeneous term q among a plurality of texture data corresponding to different reducing rates prepared in advance and establishing correspondence of the selected texture data with each of the plurality of pixels simultaneously processed.